package com.dongwq

class UrlFilterFilters {

	def filters = {
		all(controller:'*', action:'*') {
			before = {
			
				def skin = params.skin;
				
				if(!skin)
				{
					skin = 'skin_green'
				}
				request.skin = skin;
				
				request.showgrid = params.showgrid?'':'showgrid';
		   /*	
		     	def serverName = request.serverName;
				def isUrl = serverName ==~ /((\w)+\.)+(\w)+/

				if( isUrl) {
					def userUri = serverName.substring(0, serverName.indexOf(".") );
					println userUri
					if( !session.user || userUri!= session.user.uri) {

						def user = User.findByUri(userUri);

						if(user) {
							session.user = user;
						//	redirect(controller:"user", action:"home");
							return;
						}
						if( !user && actionName !='notExist') {
							redirect(controller:"user", action:"notExist");
							return;
						}
					}
				}

				println request.requestURI
				println request.requestURL
				println request.pathInfo
				println request.remoteHost
				println request.remotePort
				println ""
				println request.serverPort
				*/
			}
			after = {
			}
			afterView = {
			}
		}
	}
}
